package com.icloud.common.web.enums;

import lombok.Getter;


@Getter
public enum StateEnum {
    STOP("STOP"),
    NORMAL("NORMAL");

    private final String code;

    StateEnum(String code){
        this.code = code;
    }

    public static StateEnum byCode(String code) {
        for (StateEnum e: StateEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                return e;
            }
        }
        return null;
    }

    public static boolean isNormal(String code){
        return NORMAL.getCode().equalsIgnoreCase(code);
    }
    public static boolean isStop(String code){
        return STOP.getCode().equalsIgnoreCase(code);
    }
}
